package com.cskaoyan.controller;

import com.cskaoyan.bean.BaseRespVo;
import com.cskaoyan.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author stone
 * @date 2021/11/25 10:54
 */
@RestController
public class UserController {

    @Autowired
    UserService userService;

    @RequestMapping("hello/{name}")
    public BaseRespVo hello(@PathVariable("name")String name) {
        String value = userService.sayHello(name);
        return BaseRespVo.ok(value);
    }

    public UserController() {
        System.out.println("Controller层组件实例化");
    }
}
